***** OPEN OUTPUT LOG FILE  *****


log using "C:\Users\gk57526\Dropbox\TELs & Income Inequality (Michelle Lofton)\Data\Final Dataset\December 2024\OUTPUT\Income Inequality.BASE VARIABLES.12-10-2024.smcl", replace 




**** STATA PROGRAM CODE TO ANALYZE DATA FOR "DECOMPOSING RULES VERSUS DISCRETIONARY POLICY EFFECTS" PROJECT FROM EXISTING EXCEL DATABASE [TEL Paper Data Final 12_10_24.xlsx] AND SAVE AS BASE STATA DATABASE [Income Inequality Database.NEW VARIABLES.12-10-2024.dta] ***





** FIRST IMPORT EXCEL DATABASE WITH "12_10_24" DATABASE **

import excel "C:\Users\gk57526\Dropbox\TELs & Income Inequality (Michelle Lofton)\Data\Final Dataset\December 2024\DATA\TEL Paper Data Final 12_10_24.xlsx", sheet("Data") firstrow





*** SET DATA TO PANEL STRUCTURE  ***


xtset fips year, yearly




*** ELIMINATE NEBRASKA PANEL OF OBSERVATIONS SINCE THEY HAVE A NON-PARTISAN UNICAMERAL LEGISLATURE & ARE NON-COMPARABLE SET OF OBSERVATIONS RELATIVE TO ALL OTHER STATES **

drop if fips==31 





***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 



 
 
 
*** GENERATE MULTI-VALUED TREATMENT INDICATOR VARIABLES FROM EXISTING TEL & PARTISAN CONTROL OF GOVERNMENT DATABASE ***



** POLICYTREAT_1: TEL/NO TEL BINARY INDICATOR **

generate policytreat_1 =  1 if TEL_BI==1
replace  policytreat_1 =  0 if TEL_BI==0
*
*
*
tab policytreat_1


***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************



** POLICYTREAT_2: UNIFIED DEMOCRATIC PARTISAN CONTROL/UNIFIED REPUBLICAN PARTISAN CONTROL/DIVIDED PARTISAN CONTROL THREE-CATEGORY INDICATOR **

generate policytreat_2 =  1 if demgov==1 & uhdmaj==1 & lhdmaj==1
replace  policytreat_2 =  2 if repgov==1 & uhrmaj==1 & lhrmaj==1
replace  policytreat_2 =  0 if policytreat_2==. 
*
*
*
tab policytreat_2


***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************


** POLICYTREAT_3: TEL/NO TEL & UNIFIED DEMOCRATIC PARTISAN CONTROL/UNIFIED REPUBLICAN PARTISAN CONTROL/DIVIDED PARTISAN CONTROL COMBINATION SIX-CATEGORY INDICATOR **



* PRESENCE OF TEL-BI UNDER UNIFIED DEMOCRATIC PARTISAN CONTROL OF GOVENRMENT *
*
generate unified_dem_tel_bi = 1 if TEL_BI==1 & policytreat_2==1
*
replace  unified_dem_tel_bi = 0 if unified_dem_tel_bi==.


* ABSENCE OF TEL-BI UNDER UNIFIED DEMOCRATIC PARTISAN CONTROL OF GOVENRMENT *
*
generate unified_dem_notel_bi = 1 if TEL_BI==0 & policytreat_2==1
*
replace  unified_dem_notel_bi = 0 if unified_dem_notel_bi==.


***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************

* PRESENCE OF TEL-BI UNDER UNIFIED REPUBLICAN PARTISAN CONTROL OF GOVENRMENT *
*
generate unified_rep_tel_bi = 1 if TEL_BI==1 & policytreat_2==2
*
replace  unified_rep_tel_bi = 0 if unified_rep_tel_bi==.



* ABSENCE OF TEL-BI UNDER UNIFIED REPUBLICAN PARTISAN CONTROL OF GOVENRMENT *
*
generate unified_rep_notel_bi = 1 if TEL_BI==0 & policytreat_2==2
*
replace  unified_rep_notel_bi = 0 if unified_rep_notel_bi==.


***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 


* PRESENCE OF TEL-BI UNDER DIVIDED PARTISAN CONTROL OF GOVENRMENT *
*
generate dpc_tel_bi = 1 if TEL_BI==1 & policytreat_2==0
*
replace  dpc_tel_bi = 0 if dpc_tel_bi==.



* ABSENCE OF TEL-BI UNDER DIVIDED PARTISAN CONTROL OF GOVENRMENT *
*
generate dpc_notel_bi = 1 if TEL_BI==0 & policytreat_2==0
*
replace  dpc_notel_bi = 0 if dpc_notel_bi==.

*
*
*

tab  unified_dem_tel_bi
tab  unified_dem_notel_bi
*
tab unified_rep_tel_bi
tab unified_rep_notel_bi
*
tab  dpc_tel_bi  
tab  dpc_notel_bi



***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 


** GENERATE MULTIVALUED TREATMENT INDICATOR VARIABLE [BASELINE CATEGORY: DIVIDED PARTISAN CONTROL IN ABSENCE OF TEL (policytreat_3 = 0)] **

generate policytreat_3 = 2 if  unified_dem_notel_bi==1
*
replace  policytreat_3 = 3 if  unified_dem_tel_bi==1
*
*
replace  policytreat_3 = 4 if  unified_rep_notel_bi==1
*
replace  policytreat_3 = 5 if  unified_rep_tel_bi==1
*
*
replace  policytreat_3 = 0 if  dpc_notel_bi==1
*
replace  policytreat_3 = 1 if  dpc_tel_bi==1

*
*
*

tab policytreat_3

*
*
*


***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************




*** GENERATE WITHIN-STATE MEASURES EMPLOYED IN STATISTICAL ANALYSES *** 




*** FIRST, CONVERT SUMMARY INCOME INEQUALITY INDICES [ATKINSON & THEIL] INTO PERCENTAGES BY MULTIPLYING BY 100 ***

gen Atkin05_pct = Atkin05*100
*
gen Theil_pct = Theil*100
*
*
*
gen Gini_pct = Gini*100
*
gen RMeanDev_pct = RMeanDev*100



************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************



** 1. OUTCOME VARIABLES: SUMMARY MEASURES OF INCOME INEQUALITY [MEASURES ANALYZED IN THIS STUDY ARE THOSE WITH BOTH TRANSFER PROPERTIES & DECOMPOSABLE -- UNLIKE GINI COEFFICIENTS & RELATIVE MEAN DEVIATION MEASURES WHICH VIOLATE ONE OR BOTH OF THESE PROPERTIES] **




* 1A. ATKINSON INEQUALITY INDEX [DECOMPOSABLE & STATISFIES WEAK TRANSFERS PRINCIPLE] *  

* calculate the state group-means *
egen bAtkin05_pct = mean(Atkin05_pct), by(fips)
*
* compute the within-state deviations from the state group means *
gen wAtkin05_pct = Atkin05_pct - bAtkin05_pct
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Atkin05_pct  wAtkin05_pct, detail
*
correlate Atkin05_pct  wAtkin05_pct
*
*
*

* 1B. THEIL ENTROPY INDEX [DECOMPOSABLE & STATISFIES STRONG TRANSFERS PRINCIPLE] *

* calculate the state group-means *
egen bTheil_pct = mean(Theil_pct), by(fips)
*
* compute the within-state deviations from the state group means *
gen wTheil_pct = Theil_pct - bTheil_pct
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Theil_pct  wTheil_pct, detail
*
correlate Theil_pct  wTheil_pct
*
*
*



* 1C. GINI COEFFICIENT INEQUALITY INDEX [NON-DECOMPOSABLE & DOES NOT STATISFY WEAK NOR STRONG TRANSFERS PRINCIPLE] *  

* calculate the state group-means *
egen bGini_pct = mean(Gini_pct), by(fips)
*
* compute the within-state deviations from the state group means *
gen wGini_pct = Gini_pct - bGini_pct
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Gini_pct  wGini_pct, detail
*
correlate Gini_pct  wGini_pct
*
*
*


* 1D. REAL MEAN DEVIATION INEQUALITY INDEX [NON-DECOMPOSABLE & DOES NOT STATISFY WEAK NOR STRONG TRANSFERS PRINCIPLE] *  

* calculate the state group-means *
egen bRMeanDev_pct = mean(RMeanDev_pct), by(fips)
*
* compute the within-state deviations from the state group means *
gen wRMeanDev_pct = RMeanDev_pct - bRMeanDev_pct
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum RMeanDev_pct  wRMeanDev_pct, detail
*
correlate RMeanDev_pct  wRMeanDev_pct
*
*



***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************

 
 
** 2. OUTCOME VARIABLES: AFFLUENT/"UPPER-TAIL" INCOME SHARE BASED MEASURES OF INCOME INEQUALITY **




* 2A. TOP 10% INCOME SHARE *  

* calculate the state group-means *
egen bTop10_adj = mean(Top10_adj), by(fips)
*
* compute the within-state deviations from the state group means *
gen wTop10_adj = Top10_adj - bTop10_adj
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Top10_adj  wTop10_adj, detail
*
correlate Top10_adj  wTop10_adj
*
*
*


* 2B. TOP 1% INCOME SHARE *  

* calculate the state group-means *
egen bTop1_adj = mean(Top1_adj), by(fips)
*
* compute the within-state deviations from the state group means *
gen wTop1_adj = Top1_adj - bTop1_adj
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Top1_adj  wTop1_adj, detail
*
correlate Top1_adj  wTop1_adj
*
*
*
*


* 2C. TOP 0.1% INCOME SHARE [APPENDIX C] *  

* calculate the state group-means *
egen bTop01_adj = mean(Top01_adj), by(fips)
*
* compute the within-state deviations from the state group means *
gen wTop01_adj = Top01_adj - bTop01_adj
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Top01_adj  wTop01_adj, detail
*
correlate Top01_adj  wTop01_adj
*
*
*

* 2D. TOP 0.01% INCOME SHARE [APPENDIX C] *

* calculate the state group-means *
egen bTop001_adj = mean(Top001_adj), by(fips)
*
* compute the within-state deviations from the state group means *
gen wTop001_adj = Top001_adj - bTop001_adj
*
* compute descriptive statistics & correlation for overall measure and within-state group mean measure *
sum Top001_adj  wTop001_adj, detail
*
correlate Top001_adj  wTop001_adj
*
*
*


***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
***********************************************************************************************************************************************************************************************************
***********************************************************************************************************************************************************************************************************
*********************************************************************************************************************************************************************************************************** 
*************************************************************************************************************************************************************************************************************
*************************************************************************************************************************************************************************************************************
*************************************************************************************************************************************************************************************************************
*************************************************************************************************************************************************************************************************************




save "C:\Users\gk57526\Dropbox\TELs & Income Inequality (Michelle Lofton)\Data\Final Dataset\December 2024\DATA\Income Inequality Database.BASE VARIABLES.12-10-2024.dta", replace



*
*
*


log close
 
 
 
